$(function() {
    /*获取当前页面查询*/
    var url = location.search; //获取url中"?"符后的字串
    var request = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            request[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
        }
    }
 kkpager.generPageHtml({
        pno: request['page'] || 1,
        total: $("#kkpager").data("total"), //总页码
        mode: 'click', //默认值是link，
        click: function(n) {
            // do something
            //手动选中按钮
            request['page'] = n;
            search(request);
            return false;
        }
    });
    delete request['page']; //去掉翻页
     /*清除*/
    $(".clear").click(function() {
        var p = $(this).attr('data');
        delete request[p];
        search(request);
    });
});
/**
 * 搜索
 * @method search
 * @param  {[type]} request [description]
 * @return {[type]}         [description]
 * @author NewFuture
 */
function search(request) {
    var name = [];
    for (var q in request) {
        name.push(q);
    }
    name = name.sort(); //对字段排序排序
    var s = "?"; //拼接请求字符串
    for (var i = name.length - 1; i >= 0; i--) {
        s += name[i] + "=" + request[name[i]] + "&";
    };
    s = s.substr(0, s.length - 1);
    location.search = s;
}
/*设置*/
$(".tool_btn").click(function(){
    var tool_ps = $(this).position();
    $(this).parent().find('.tool_box').slideDown('slow');
    $(this).parent().find('.tool_box').css("position", "absolute");
    $(this).parent().find('.tool_box').css("left", tool_ps.left); //距离左边距
    $(this).parent().find('.tool_box').css("top", tool_ps.top + 30); //距离上边距    
}).parent().mouseleave(function(){
    $(this).parent().find('.tool_box').slideUp('slow');
});